<!--
    页面名称：管理员 - 查看指定员工信息
    作者: 苗怀雨
    时间:2017-12-31 22:46:30
-->

<%@ page language="java" contentType="text/html; charset=UTF-8"
		 pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="tag" tagdir="/WEB-INF/tags" %>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE html>
<html>
<tag:head title="图书信息" ctx="${ctx}">
	<link href="${ctx}/assets/css/admin/admin_department_add/style.css" rel="stylesheet">	<!-- this page -->
</tag:head>

<tag:body>
	<!-- 左 上 导航 -->
	<tag:nav ctx="${ctx}"></tag:nav>

	<!-- page content -->
	<tag:content title="图书信息">
		<div class="col-sm-12">
			<form action="${ctx}/admin/updateBook" method="post">
				<div class="form-group col-sm-12">
					<div class="col-sm-6">
						<img id="preview" src="${ctx}/${requestScope.book.bookImage}" width="180px" height="180px" />
					</div>
				</div>
				<div class="form-group col-sm-12">
					<div class="col-sm-2">
						<button type="button" class="btn btn-primary">更改封面图片</button>
					</div>
				</div>
				<div class="form-group col-sm-12" style="display:none;">
					<label class="control-label col-sm-2">书籍ID:</label>
					<div class="col-sm-2">
						<input type="text" name="bookId" value="${requestScope.book.bookId}" class="form-control col-md-3 col-xs-12"/>										</div>
				</div>
				<div class="form-group col-sm-12">
					<label class="control-label col-sm-2">书名:</label>
					<div class="col-sm-4">
						<input type="text" name="bookName" placeholder="长度在1到20之间" value="${requestScope.book.name}" class="form-control col-md-3 col-xs-12"/>
					</div>
				</div>
				<div class="form-group col-sm-12">
					<label class="control-label col-sm-2">作者:</label>
					<div class="col-sm-4">
						<input type="text" name="author" placeholder="长度在1到20之间" value="${requestScope.book.author}"  class="form-control col-md-3 col-xs-12"/>
					</div>
				</div>
				<div class="form-group col-sm-12">
					<label class="control-label col-sm-2">出版社:</label>
					<div class="col-sm-5">
						<input type="text" name="publish" placeholder="长度在1到20之间" value="${requestScope.book.publish}" class="form-control col-md-3 col-xs-12"/>
					</div>
				</div>
				<div class="form-group col-sm-12">
					<label class="control-label col-sm-2">ISBN:</label>
					<div class="col-sm-4">
						<input type="text" name="ISBN" placeholder="长度在1到15之间" value="${requestScope.book.ISBN}" class="form-control col-md-3 col-xs-12"/>
					</div>
				</div>
				<div class="form-group col-sm-12">
					<label class="control-label col-sm-2">价格:</label>
					<div class="col-sm-10">
						<input type="text" name="bookPrice" placeholder="价格在1到2000之间" value="${requestScope.book.price}" class="form-control col-md-3 col-xs-12"/>
					</div>
				</div>
				<div class="form-group col-sm-12">
					<label class="control-label col-sm-2">等级:</label>
					<div class="col-sm-4">
						<c:choose>
							<c:when test="${requestScope.book.grade == null}">暂无评分</c:when>
							<c:otherwise>
								<c:forEach begin="1" end="${requestScope.book.grade}">
									<i class="fa fa-star"></i>
								</c:forEach>
								${book.grade}分
							</c:otherwise>
						</c:choose>
					</div>
					<div class="col-sm-5">

					</div>
				</div>
				<div class="form-group col-sm-12">
					<label class="control-label col-sm-2">类别:</label>
					<div class="col-sm-2">
						<select class="form-control" id="bookClass" name="bookClass">
							<c:forEach var="bookClass" items="${requestScope.bookClasses}">
								<option value="${bookClass.bookClassId}">${bookClass.name}</option>
							</c:forEach>
						</select>
						<div class="error"></div>
					</div>
				</div>
				<div class="form-group col-sm-12">
					<label class="control-label col-sm-2">在库状态:</label>
					<div class="col-sm-4">
						<div class="radio">
							<label>
								<input type="radio" value="0" name="bookState"> 在库
							</label>
						</div>
						<div class="radio">
							<label>
								<input type="radio" value="1" name="bookState"> 借出
							</label>
						</div>
						<div class="radio">
							<label>
								<input type="radio" value="2" name="bookState"> 丢失
							</label>
						</div>
					</div>
				</div>
				<div class="form-group col-sm-12">
					<div class="col-sm-12">
						<button id="save" type="button" class="btn btn-success">保存</button>
						<button type="button" class="btn btn-info">返回</button>
					</div>
				</div>
				<div class="emptyRow"></div>
			</form>
		</div>
	</tag:content>

	<!-- footer content -->
	<tag:footer></tag:footer>
</tag:body>
<tag:javascript ctx="${ctx}">
	<script src="${ctx}/assets/js/admin/admin_book_info/admin_book_info.js"></script>	<!-- this page -->
	<script>
		$("#bookClass").val(${requestScope.book.bookClass.bookClassId});
		$("input[name='bookState']").eq(${requestScope.book.state}).prop("checked","checked");
	</script>
</tag:javascript>
</html>
